<?php
/**
 *  StorableObject class unit tests
 *
 *  @author Jean-Lou Dupont
 *  @version @@package-version@@
 */

require_once 'PHPUnit/Framework.php';
require_once 'web-bloks/Identifier/Identifier.php';

class UnitTest extends PHPUnit_Framework_TestCase
{
	var $obj = null;
	
	public function setup()
	{
    	$this->obj = new WB_Identifier;	
		$this->obj->setSchema( array( 'part1', 'part2', 'part3' ) );
	}

    public function test1()
    {
		$this->obj->set( 'part1/part2' );
		
		// Assert that the size of the Array fixture is 1.
        $this->assertEquals( 'part1/part2' , $this->obj->get() );
    }

	public function test2()
	{
		$this->obj->part1 = 'part1_value';
		$this->obj->part2 = 'part2_value';
		
        $this->assertEquals( 'part1_value' , $this->obj->part1 );		
        $this->assertEquals( 'part2_value' , $this->obj->part2 );				
	}

	public function test3()
	{
		$this->obj->part1 = 'part1_value';
		$this->obj->part2 = 'part2_value';
		
        $this->assertEquals( 'part1_value/part2_value' , $this->obj->get() );		
	}

	public function test4()
	{
		$this->obj->set( 'part1_value/part2_value/part3_value/part4_value' );
		#echo "parts>> ";
		#var_dump( $this->obj->getParts() );
		
        $this->assertEquals( 'part1_value' , $this->obj->part1 );		
        $this->assertEquals( 'part2_value' , $this->obj->part2 );				
        $this->assertEquals( 'part3_value/part4_value' , $this->obj->part3 );				
	}
	
}